package io.renren.modules.manage.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.manage.entity.FreshUserEntity;
import io.renren.modules.manage.service.FreshUserService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 *
 *
 * @author hyc
 * @email 2250242464qq.com
 * @date 2024-03-08 23:09:55
 */
@RestController
@RequestMapping("manage/user")
public class FreshUserController {
    @Autowired
    private FreshUserService freshUserService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("manage:user:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = freshUserService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("manage:user:info")
    public R info(@PathVariable("id") String id){
		FreshUserEntity user = freshUserService.getById(id);

        return R.ok().put("user", user);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("manage:user:save")
    public R save(@RequestBody FreshUserEntity user){
		freshUserService.save(user);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("manage:user:update")
    public R update(@RequestBody FreshUserEntity user){
		freshUserService.updateById(user);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("manage:user:delete")
    public R delete(@RequestBody String[] ids){
		freshUserService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
